package com.lee.enjoy04_221113.workers

import android.content.Context
import android.util.Log
import androidx.work.Data
import androidx.work.Worker
import androidx.work.WorkerParameters

/**
 *
 * @ProjectName: LifeCycleTest
 * @Package: com.lee.enjoy04_221113.workers
 * @ClassName: MyWorker1
 * @Description: java类作用描述
 * @Author: 李占伟
 * @CreateDate: 2022/11/13 22:48
 * @UpdateUser: 更新者
 * @UpdateDate: 2022/11/13 22:48
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */

class MyWorker(context:Context,val workerParameters: WorkerParameters):Worker(
    context,workerParameters
) {
    companion object{
        const val TAG = "MyWorker"
    }
    override fun doWork(): Result {
        var inputData = workerParameters.inputData
        Log.i(TAG,"开始执行任务.....${inputData.getString("lzw")}")
        Thread.sleep(10*1000)
        val outData = Data.Builder().putString("name","lizw").build()
        return  Result.success(outData)

    }
}